Namespace("sketch.ui.iphone");

(function(ui) {
    "strict mode";

    var fwk = sketch.framework;

    ui.iphone.Dialog = klass(ui.common.DockPannel, (function() {
        return {
            _constructor:function() {
                this._fillResource = fwk.Resources['dialog'];
                this._stroke = '#FFFFFF';
                this.width(280);
                this.height(140);

                var button = new ui.iphone.BarItem();
                button.label("OK");
                button.top(102);
                button.left(7);
                button.width(266);
                button.style("Silver");
                this.add(button);

                var title = new ui.iphone.Label();
                title.text('A Short Title');
                title.width(280);
                title.top(10);
                title.textAlign('center');
                title.font().color("#FFFFFF");
                var font = title.font();
                font.size(16);
                font.bold(true);
                this.add(title);

                var text = new ui.iphone.Label();
                text.text('A message should be a short, complete sentence.');
                text.width(280);
                text.top(40);
                text.textAlign('center');
                text.font().color("#FFFFFF");
                font = text.font();
                font.size(14);
                this.add(text);
                this.enableGroupLocking(true);
            },
            drawSelf:function(context) {
                var x = this.left(),
                    y = this.top(),
                    w = this.width(),
                    h = this.height();
                context.save();
                var brush = this._fillResource.toBrush(context, 0, y, 0, y + h);
                context.fillStyle = brush;
                context.lineWidth = 2;
                context.strokeStyle = this._stroke;

                context.roundedRectPath(x, y, w, h, 10, 10, brush, this._stroke);
                context.fill();
                context.stroke();

                context.restore();
                ui.iphone.Dialog.Super.drawSelf.call(this, context);
            }
        };
    })());
})(sketch.ui);